package com.question.business.menu.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.question.business.menu.entity.MenuInterface;
import com.question.business.menu.model.vo.MenuInterfaceVO;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * 菜单接口Mapper接口
 *
 * @author star
 * @since 2023-09-11
 */
@Mapper
public interface MenuInterfaceMapper extends BaseMapper<MenuInterface> {

    /**
     * 菜单接口查询
     *
     * @param menuId 菜单ID
     * @return List<MenuInterfaceVO> 响应参数
     */
    @Select("SELECT id, url FROM t_menu_interface WHERE is_deleted = 0 AND menu_id = #{menuId}")
    List<MenuInterfaceVO> queryMenuInterfaceList(String menuId);

    /**
     * 根据菜单ID删除历史菜单接口
     *
     * @param menuId 菜单ID
     */
    @Delete("DELETE FROM t_menu_interface WHERE menu_id = #{menuId}")
    void deleteByMenuId(String menuId);
}